<?php 
include('../common/_const.php');
include('../common/common.php');
include('../common/checksession.php');
checksession("../index.php");
include('../../inc/conn.php');

$gurl=$_POST['gurl'];
checkillegalword($gurl);//过滤非法字符


$m=array();
foreach($_POST as $k=>$v){
	
	if(strstr($k,"rank")){
		isnum($v,"排序应是一个数值!",$gurl);
		$rid=explode("_",$k);
		$m[]=array("id"=>$rid[1],"rank"=>$v);
		}
}


if(count($m)){
$db=db_connect();//数据库连
foreach($m as $k=>$v){
	$sql="UPDATE `".PRETABLE."arctype` SET `sortrank` = '".$v['rank']."' WHERE `id`='".$v['id']."'";
	$db->query($sql) or die("datebase error");
}
$db->close();
ShowMsg_h("更新成功!",$gurl);
}else{
ShowMsg("没有栏目",$gurl);
exit;
}
?>